package com.dean.practice.gateway.ctrl;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author Dean
 * @date 2021-05-04
 */
@RestController
public class DashboardCtrl {

    @GetMapping(path = "/principal")
    public Object jwtInfo(@AuthenticationPrincipal Principal principal) {
        return principal;
    }

    @GetMapping("/")
    public Jwt index(@AuthenticationPrincipal Jwt jwt) {
        return jwt;
    }
}